<?php
// +----------------------------------------------------------------------
// | Bwsaas
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2020 http://www.buwangyun.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Gitee ( https://gitee.com/buwangyun/bwsaas )
// +----------------------------------------------------------------------
// | Author: buwangyun <hnlg666@163.com>
// +----------------------------------------------------------------------
// | Date: 2020-9-28 10:55:00
// +----------------------------------------------------------------------

use think\facade\Route;

/**
 * 无需登录与鉴权的接口
 */
Route::get('member/login', 'member.Index/login')->middleware(buwang\middleware\Login::class, false);
Route::post('member/login', 'member.Index/login')->middleware(buwang\middleware\Login::class, false);
Route::get('member/forget', 'member.Index/forget')->middleware(buwang\middleware\Login::class, false);
Route::post('member/forget', 'member.Index/forget')->middleware(buwang\middleware\Login::class, false);
Route::rule('member/add', 'member.Index/add')->middleware(buwang\middleware\Login::class, false);
//    Route::get('common/map', 'Common/map');
//    Route::get('common/baiduMap', 'Common/baiduMap');
Route::get('common/getMapData', 'Common/getMapData')->middleware(buwang\middleware\Login::class, false);
//    Route::get('common/cityInfo', 'Common/cityInfo');
//充值回调
Route::rule('recharge/notify', 'member.Notify/index')->middleware(buwang\middleware\Login::class, false);
Route::rule('recharge/ali_notify_page', 'member.Notify/ali_notify_page')->middleware(buwang\middleware\Login::class, false);
//租户充值定时任务
Route::get('recharge/checkOrderStatus', 'member.Recharge/checkOrderStatus')->middleware(buwang\middleware\Login::class, false);
//公众号管理图文预览
Route::rule('member.WechatKeyword/previewView', 'member.WechatKeyword/previewView')->middleware(buwang\middleware\Login::class, false);//租户应用后台
//配置相关
Route::rule('member/config/setMemberValues', 'member.Config/setMemberValues')->middleware(buwang\middleware\Login::class, false);//旧ui
Route::rule('member/config/setMemberValuesNew', 'member.Config/setMemberValuesNew')->middleware(buwang\middleware\Login::class, false);//新ui

/**
 * 需要登录不鉴权
 */
Route::group(function () {
    Route::get('member/appMenu', 'member.Index/getUserAppAuthedMenuTree');
    Route::post('member/logout', 'member.Index/logout');
    Route::get('member', 'member.Index/index');//老ui应用首页
    Route::get('member/index', 'member.Index/index');//老ui应用首页
    Route::get('member/menu', 'member.Index/menu');

//    Route::post('member.publicCommon/uploadimg', 'member.publicCommon/uploadimg');
    //删除文件
    Route::post('member.publicCommon/delFile', 'member.publicCommon/delFile');

    //应用登录信息
    Route::get('member/miniapp/login', 'member.miniapp/miniappLogin');

    //小程序新增
    //获取基本信息
    Route::get('member/getAccountBasicInfo', 'member.WechatProgramController/getAccountBasicInfo');
    //获取隐私接口检测结果
    Route::get('member/mnGetCodePrivacyInfo', 'member.WechatProgramController/mnGetCodePrivacyInfo');
    //小程序认证上传补充材料
    Route::post('member/mnUploadAuthMaterial', 'member.WechatProgramController/mnUploadAuthMaterial');
    //小程序认证
    Route::post('member/mnAuth', 'member.WechatProgramController/mnAuth');
    //小程序认证-重新提交
    Route::post('member/mnReauth', 'member.WechatProgramController/mnReauth');
    //小程序认证进度查询
    Route::post('member/mnQueryAuth', 'member.WechatProgramController/mnQueryAuth');
    //查询个人认证身份选项列表
    Route::post('member/mnAuthidentitytree', 'member.WechatProgramController/mnAuthidentitytree');

    //获取小程序用户隐私保护指引
    Route::post('member/mnGetPrivacySetting', 'member.WechatProgramController/mnGetPrivacySetting');
    //设置小程序用户隐私保护指引
    Route::post('member/mnSetPrivacySetting', 'member.WechatProgramController/mnSetPrivacySetting');

    //发起小程序管理员人脸核身
    Route::post('member/mnCreateIcpVerifyTask', 'member.WechatProgramController/mnCreateIcpVerifyTask');
    //查询人脸核身任务状态
    Route::post('member/mnQueryIcpVerifyTask', 'member.WechatProgramController/mnQueryIcpVerifyTask');
    //获取单位性质
    Route::post('member/mnQueryIcpSubjectTypes', 'member.WechatProgramController/mnQueryIcpSubjectTypes');
    //获取区域信息
    Route::post('member/mnQueryIcpDistrictCode', 'member.WechatProgramController/mnQueryIcpDistrictCode');
    //获取证件类型
    Route::post('member/mnQueryIcpCertificateTypes', 'member.WechatProgramController/mnQueryIcpCertificateTypes');
    //上传小程序备案媒体材料
    Route::post('member/mnUploadIcpMedia', 'member.WechatProgramController/mnUploadIcpMedia');
    //申请小程序备案
    Route::post('member/mnApplyIcpFiling', 'member.WechatProgramController/mnApplyIcpFiling');
    //获取小程序备案状态及驳回原因
    Route::post('member/mnGetIcpEntranceInfo', 'member.WechatProgramController/mnGetIcpEntranceInfo');


})->middleware(buwang\middleware\Login::class, true);
//租户应用购买页应用详情
Route::rule('member.miniapp/detailNew', 'member.miniapp/detailNew')->middleware(buwang\middleware\Login::class, true);
//获取上传的文件列表
Route::get('member.publicCommon/getUploadFiles', 'member.publicCommon/getUploadFiles')->middleware(buwang\middleware\Login::class, true);
//获取文件分组
Route::get('member.publicCommon/getUploadFileGroup', 'member.publicCommon/getUploadFileGroup')->middleware(buwang\middleware\Login::class, true);
//添加文件分组
Route::post('member.publicCommon/addUploadFileGroup', 'member.publicCommon/addUploadFileGroup')->middleware(buwang\middleware\Login::class, true);
//编辑文件分组
Route::post('member.publicCommon/editUploadFileGroup', 'member.publicCommon/editUploadFileGroup')->middleware(buwang\middleware\Login::class, true);
//删除文件分组
Route::post('member.publicCommon/delUploadFileGroup', 'member.publicCommon/delUploadFileGroup')->middleware(buwang\middleware\Login::class, true);
//上传文件
Route::post('member.publicCommon/upload', 'member.publicCommon/upload')->middleware(buwang\middleware\Login::class, true);
/**
 * 需要登录与鉴权的接口
 */
Route::group('member', function () {
    Route::get('dashboard', 'member.Index/dashboard');
    Route::get('openAuth', 'member.WechatAuth/openAuth');//租户应用后台
    Route::get('openAuthCallback', 'member.WechatAuth/openAuthCallback');//租户应用后台
    Route::get('loginInfo', 'member.Index/getMemberLoginInfo');
    Route::get('noticeList', 'member.Index/getNoticeList');
    Route::get('echartsInfo', 'member.Index/getEchartsInfo');

    //租户应用后台
    //开放平台设置小程序域名
    Route::post('setDomain', 'member.Miniapp/setDomain');
    //第三方平台代提交代码接口
    Route::post('upCode', 'member.Miniapp/upCode');
    //提交审核页面
    Route::rule('submitAudit', 'member.Miniapp/submitAudit');
    //第三方平台拉取小程序体验二维码
    Route::get('getQrCode', 'member.Miniapp/getQrCode');
    //第三方平台获取小程序代码审核状态
    Route::get('getAuditStatus', 'member.Miniapp/getAuditStatus');
    //第三方平台强制撤销审核
    Route::post('resetAudit', 'member.Miniapp/resetAudit');
    //第三方平台发布小程序
    Route::post('publishCode', 'member.Miniapp/publishCode');

    //系统插件管理-租户应用后台-插件中心
    Route::rule('plugin/core/index', 'member.plugin.Core/index'); //插件列表
    Route::rule('plugin/core/menu', 'member.plugin.Core/menu');   //渲染菜单

    //租户资金变更类
    Route::rule('walletBill', 'member.WalletBill/index');
    Route::rule('walletBill/index', 'member.WalletBill/index');

    //充值
    Route::get('recharge', 'member.Recharge/index');
    Route::post('recharge/pay', 'member.Recharge/pay');


    //站内信
    Route::get('message/list', 'member.Index/messageList');
    Route::get('message/read', 'member.Index/messageRead');
    Route::rule('message/send', 'member.User/sendMessage');//发送站内信

    //插件市场-租户应用后台
    Route::get('plugin', 'member.plugin.Plugin/index');
    Route::get('plugin/detail', 'member.plugin.Plugin/detail');
    Route::post('plugin/buy', 'member.plugin.Plugin/buy');


    //微信-租户应用后台-消息-消息模板
    Route::get('wechat/message/template/index', 'member.WechatMessageTemplate/index');
//                Route::get('export', 'member.WechatMessageTemplate/export');
    Route::rule('wechat/message/template/add', 'member.WechatMessageTemplate/add');
    Route::rule('wechat/message/template/edit', 'member.WechatMessageTemplate/edit');
    Route::post('wechat/message/template/modify', 'member.WechatMessageTemplate/modify');
    Route::post('wechat/message/template/del', 'member.WechatMessageTemplate/del');
    //微信-租户应用后台-消息-消息记录
    Route::get('wechat/message/messageLog/index', 'member.WechatMessageLog/index');
//                Route::get('export', 'member.WechatMessageLog/export');
//                Route::rule('add', 'member.WechatMessageLog/add');
//                Route::rule('edit', 'member.WechatMessageLog/edit');
//                Route::post('modify', 'member.WechatMessageLog/modify');
    Route::post('wechat/message/messageLog/del', 'member.WechatMessageLog/del');

})->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//获取支付宝PC支付页面
Route::get('member/recharge/page', 'member.Recharge/page')->middleware(buwang\middleware\Login::class, true);

//云市场
Route::group('member/cloud', function () {
    //云市场服务类
    Route::rule('service', 'member.cloud.Service/index');
    Route::rule('service/index', 'member.cloud.Service/index');
    Route::rule('service/detail', 'member.cloud.Service/detail');
    //云市场套餐类
    Route::rule('packet', 'member.cloud.Packet/index');
    Route::rule('packet/index', 'member.cloud.Packet/index');
    Route::post('packet/buy', 'member.cloud.Packet/buy');

    //云市场次数记录类
    Route::rule('walletBill', 'member.cloud.WalletBill/index');
    Route::rule('walletBill/index', 'member.cloud.WalletBill/index');

    //云市场订单类
    Route::rule('order', 'member.cloud.Order/index');
    Route::rule('order/index', 'member.cloud.Order/index');

})->middleware(buwang\middleware\Login::class, true);

//关于应用
Route::get('member.setting/index', 'member.setting/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);//菜单
Route::post('member.setting/wechat', 'member.setting/wechat')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);
Route::post('member.setting/alipay', 'member.setting/alipay')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);
Route::post('member.setting/tt_wechat', 'member.setting/tt_wechat')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);//头条微信支付配置
Route::post('member.setting/edit', 'member.setting/edit')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);

Route::group(function () {
    //租户角色
    Route::get('member.Role/index', 'member.Role/index');
    Route::rule('member.Role/add', 'member.Role/add');
    Route::rule('member.Role/edit', 'member.Role/edit');
    Route::rule('member.Role/getRoleTree', 'member.Role/getRoleTree');
    Route::rule('member.Role/getNodeTree', 'member.Role/getNodeTree');
    Route::rule('member.Role/delete', 'member.Role/delete');
    Route::rule('member.Role/setStatus', 'member.Role/setStatus');

    //租户管理员管理
    Route::get('member.login/user', 'member.login/user');
    //子租户管理
    Route::rule('member.Login/add', 'member.Login/add');
    Route::rule('member.Login/edit', 'member.Login/edit');
    Route::rule('member.Login/delete', 'member.Login/delete');
    Route::rule('member.Login/setStatus', 'member.Login/setStatus');

    Route::rule('member/login/userPassword', 'member.Login/userPassword');




    //用户充值管理
    Route::rule('member/user/recharge/index', 'member.user.Recharge/index');
//    Route::get('member/user/recharge/export', 'member.user.Recharge/export');
//    Route::rule('member/user/recharge/add', 'member.user.Recharge/add');
//    Route::rule('member/user/recharge/edit', 'member.user.Recharge/edit');
//    Route::post('member/user/recharge/modify', 'member.user.Recharge/modify');

    //用户资金记录
    Route::rule('member/user/bill/index', 'member.user.Bill/index');
//    Route::get('member/user/bill/export', 'member.user.Bill/export');
//    Route::rule('member/user/bill/add', 'member.user.Bill/add');
//    Route::rule('member/user/bill/edit', 'member.user.Bill/edit');
//    Route::post('member/user/bill/modify', 'member.user.Bill/modify');

    //提现管理页面
    Route::rule('member/user/extract/index', 'member.user.Extract/index');
//    Route::get('member/user/extract/export', 'member.user.Extract/export');
//    Route::rule('member/user/extract/add', 'member.user.Extract/add');
    Route::rule('member/user/extract/edit', 'member.user.Extract/edit');
//    Route::post('member/user/extract/modify', 'member.user.Extract/modify');
    Route::post('member/user/extract/del', 'member.user.Extract/del');

    //提现记录
    Route::rule('member/user/extractLog/index', 'member.user.ExtractLog/index');
//    Route::get('member/user/extractLog/export', 'member.user.ExtractLog/export');
//    Route::rule('member/user/extractLog/add', 'member.user.ExtractLog/add');
    Route::rule('member/user/extractLog/edit', 'member.user.ExtractLog/edit');
//    Route::post('member/user/extractLog/modify', 'member.user.ExtractLog/modify');
    Route::post('member/user/extractLog/del', 'member.user.ExtractLog/del');

//    //快递管理
//    Route::rule('member/sys/express/index', 'member.sys.Express/index');
//    Route::get('member/sys/express/export', 'member.sys.Express/export');
//    Route::rule('member/sys/express/add', 'member.sys.Express/add');
//    Route::rule('member/sys/express/edit', 'member.sys.Express/edit');
//    Route::post('member/sys/express/modify', 'member.sys.Express/modify');
//    Route::post('member/sys/express/del', 'member.sys.Express/del');
})->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//图文素材管理-租户应用后台
Route::rule('member.wechatKeyword/materialList', 'member.wechatKeyword/materialList')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.wechatKeyword/addMaterial', 'member.wechatKeyword/addMaterial')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member.wechatKeyword/removeMaterial', 'member.wechatKeyword/removeMaterial')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//    Route::get('member.wechatKeyword/editMaterial', 'member.wechatKeyword/editMaterial');

//关键字回复规则管理-租户应用后台
Route::rule('member.wechatKeyword/index', 'member.wechatKeyword/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.wechatKeyword/edit', 'member.wechatKeyword/edit')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.wechatKeyword/del', 'member.wechatKeyword/del')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.wechatKeyword/addKeys', 'member.wechatKeyword/addKeys')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewText', 'member.wechatKeyword/previewText')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewNews', 'member.wechatKeyword/previewNews')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/select', 'member.wechatKeyword/select')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewImage', 'member.wechatKeyword/previewImage')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewMusic', 'member.wechatKeyword/previewMusic')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewVideo', 'member.wechatKeyword/previewVideo')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member.wechatKeyword/previewVoice', 'member.wechatKeyword/previewVoice')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member.wechatKeyword/modify', 'member.wechatKeyword/modify')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.wechatKeyword/subscribe', 'member.wechatKeyword/subscribe')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//公众号菜单管理-租户应用后台
Route::rule('member.official/index', 'member.official/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.official/add', 'member.official/add')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.official/edit', 'member.official/edit')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.official/del', 'member.official/del')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member.official/sync', 'member.official/sync')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//    Route::rule('member.official/sort', 'member.official/sort');
Route::rule('member.official/materialList', 'member.official/materialList')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//配置
Route::rule('member/config/showMemberConfig', 'member.Config/showMemberConfig')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/config/showMemberConfig/:type/[:tab_name]/[:config_ids]/[:app]/[:plugin]', 'member.Config/showMemberConfig')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);//动态config访问规则


Route::rule('member_login/userSetting', 'member.Login/userSetting')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//租户应用
Route::rule('member_miniapp_my/index', 'member.MemberMiniapp/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member_miniapp_my/default', 'member.MemberMiniapp/setDefaultMiniapp')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);//设置默认应用

//应用商店
Route::rule('member/miniapp/index', 'member.miniapp/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/miniapp/detail', 'member.miniapp/detail')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member/miniapp/buy', 'member.miniapp/buy')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);


//用户管理
Route::get('member/user/index', 'member.User/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//    Route::get('member/user/export', 'member.User/export');
//    Route::rule('member/user/add', 'member.User/add');
Route::rule('member/user/edit', 'member.User/edit')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/user/detail', 'member.User/detail')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/user/editPw', 'member.User/editPw')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/user/changeMoney', 'member.User/changeMoney')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member/user/modify', 'member.User/modify')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//系统操作日志
Route::rule('member_sys_log/index', 'member.sys.Log/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//    Route::get('member/sys/log/export', 'member.sys.Log/export');
//    Route::rule('member/sys/log/add', 'member.sys.Log/add');
//    Route::rule('member/sys/log/edit', 'member.sys.Log/edit');
//    Route::post('member/sys/log/modify', 'member.sys.Log/modify');
Route::get('member_sys_log/removeAll', 'member.sys.Log/removeAll')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);


//组合数据
Route::rule('member/groupData/edit', 'member.GroupData/edit')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
//    Route::rule('member.GroupData/del', 'member.GroupData/softdleting');
Route::rule('member/groupData/add', 'member.GroupData/add')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::post('member/groupData/softdleting', 'member.GroupData/softdleting')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/groupData/getConfigList', 'member.GroupData/getConfigList')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::rule('member/groupData/setConfigShow', 'member.GroupData/setConfigShow')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member/groupData', 'member.GroupData/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);
Route::get('member/groupData/:type/:app/[:plugin]', 'member.GroupData/index')->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class);

//必要的菜单管理权进行登录鉴权
//Route::group(function () {
//})->middleware(buwang\middleware\Login::class, true)->middleware(buwang\middleware\Auth::class)->append(['bwsaas' => true]);
